<?php
	$file = $_FILES['img'];
	if($file['error']==0 && is_uploaded_file($file['tmp_name'])){
		$toFile = './upload/'.$file['name'];
		if(move_uploaded_file($file['tmp_name'],$toFile)){
			$json=array('error' => 0, 'url' => $toFile);
			echo json_encode($json);
			exit;
		}
	}
	$json=array('error' => 1, 'message' => '上传失败，图像过大或类型不允许');
	echo json_encode($json);exit;
?>